<?php
/* --------------------------------------------------------------
   gambio_error_report.php 2010-01-29 gambio
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2010 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/

defined( '_VALID_XTC' ) or die( 'Direct Access to this location is not allowed.' );

				
define('MODULE_GAMBIO_ERROR_REPORT_TEXT_DESCRIPTION', 'Berichterstattung f&uuml;r PHP- und SQL-Fehler');
define('MODULE_GAMBIO_ERROR_REPORT_TEXT_TITLE', 'Gambio Fehlerberichte');

define('MODULE_GAMBIO_ERROR_REPORT_DETAILS_SCREEN_TITLE' , '<hr noshade>Details im Shop:');
define('MODULE_GAMBIO_ERROR_REPORT_DETAILS_SCREEN_DESC' , 'Ausf&uuml;hrlichere Fehlerdetails im Shop ausgeben (nicht empfohlen)');

define('MODULE_GAMBIO_ERROR_REPORT_DETAILS_FILE_TITLE' , '<hr noshade>Details in Logdatei:');
define('MODULE_GAMBIO_ERROR_REPORT_DETAILS_FILE_DESC' , 'Ausf&uuml;hrlichere Fehlerdetails in Logdatei ausgeben');

define('MODULE_GAMBIO_ERROR_REPORT_DETAILS_MAIL_TITLE' , '<hr noshade>Details in E-Mail:');
define('MODULE_GAMBIO_ERROR_REPORT_DETAILS_MAIL_DESC' , 'Ausf&uuml;hrlichere Fehlerdetails per E-Mail senden');

define('MODULE_GAMBIO_ERROR_REPORT_EMAIL_TITLE' , '<hr noshade>E-Mail-Fehlerberichte an:');
define('MODULE_GAMBIO_ERROR_REPORT_EMAIL_DESC' , 'Keine Berichte senden: Feld leer lassen.<br>Gambio Support: debug@gambio-support.de');

define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ERROR_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ERROR_DESC' , 'Keine Berichte senden: Feld leer lassen.<br>Gambio Support: debug@gambio-support.de');


define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ERROR_TITLE' , '<hr noshade>E_ERROR-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_WARNING_TITLE' , '<hr noshade>E_WARNING-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_PARSE_TITLE' , '<hr noshade>E_PARSE-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_NOTICE_TITLE' , '<hr noshade>E_NOTICE-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_ERROR_TITLE' , '<hr noshade>E_CORE_ERROR-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_WARNING_TITLE' , '<hr noshade>E_CORE_WARNING-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_ERROR_TITLE' , '<hr noshade>E_COMPILE_ERROR-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_WARNING_TITLE' , '<hr noshade>E_COMPILE_WARNING-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_ERROR_TITLE' , '<hr noshade>E_USER_ERROR-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_WARNING_TITLE' , '<hr noshade>E_USER_WARNING-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_NOTICE_TITLE' , '<hr noshade>E_USER_NOTICE-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ALL_TITLE' , '<hr noshade>E_ALL-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_STRICT_TITLE' , '<hr noshade>E_STRICT-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_RECOVERABLE_ERROR_TITLE' , '<hr noshade>E_RECOVERABLE_ERROR-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_DEPRECATED_TITLE' , '<hr noshade>E_DEPRECATED-Meldungen unterdr&uuml;cken');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_DEPRECATED_TITLE' , '<hr noshade>E_USER_DEPRECATED-Meldungen unterdr&uuml;cken');

define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ERROR_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_WARNING_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_PARSE_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_NOTICE_DESC' , '(Dringend empfohlen!)');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_ERROR_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_WARNING_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_ERROR_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_WARNING_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_ERROR_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_WARNING_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_NOTICE_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ALL_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_STRICT_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_RECOVERABLE_ERROR_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_DEPRECATED_DESC' , '');
define('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_DEPRECATED_DESC' , '');



// include needed functions
class gambio_error_report {
	var $code, $title, $description, $enabled;

	function gambio_error_report() {
		global $order;

     $this->code = 'gambio_error_report';
     $this->title = MODULE_GAMBIO_ERROR_REPORT_TEXT_TITLE;
     $this->description = MODULE_GAMBIO_ERROR_REPORT_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_GAMBIO_ERROR_REPORT_SORT_ORDER;
     $this->enabled = ((MODULE_GAMBIO_ERROR_REPORT_STATUS == 'True') ? true : false);
     $this->CAT=array();
     $this->PARENT=array();
   }

	function process($file) {

	}

	function display() 
	{
		$coo_error_log = new FileLog('errors');
		$t_logfile_url = HTTP_SERVER.DIR_WS_CATALOG.$coo_error_log->get_file_path();
		
		return array('text' => 
                            '<br><div align="center">' .
							'<a href="'.$t_logfile_url.'"><u>Fehlerbericht runterladen</u></a><br><br>'.
							xtc_button('OK') .
                            xtc_button_link(BUTTON_CANCEL, xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=gambio_error_report')) . "</div>");
	}

	function check() {
		if (!isset($this->_check)) {
			$check_query = xtc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_GAMBIO_ERROR_REPORT_EMAIL'");
			$this->_check = xtc_db_num_rows($check_query);
		}
		return $this->_check;
	}

	function install() {
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_DETAILS_SCREEN', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_DETAILS_FILE', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_DETAILS_MAIL', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_EMAIL', '',  '6', '1', '', now())");

		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ERROR', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_WARNING', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_PARSE', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_NOTICE', 'True',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_ERROR', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_WARNING', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_ERROR', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_WARNING', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_ERROR', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_WARNING', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_NOTICE', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ALL', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_STRICT', 'True',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_RECOVERABLE_ERROR', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_DEPRECATED', 'True',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
		xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value,  configuration_group_id, sort_order, set_function, date_added) values ('MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_DEPRECATED', 'False',  '6', '1', 'gm_cfg_select_option(array(\'True\', \'False\'), ', now())");
	}

	function remove() {
		xtc_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
	}

	function keys() 
	{
		return array(
			'MODULE_GAMBIO_ERROR_REPORT_DETAILS_SCREEN',
			'MODULE_GAMBIO_ERROR_REPORT_DETAILS_FILE',
			'MODULE_GAMBIO_ERROR_REPORT_DETAILS_MAIL',
			'MODULE_GAMBIO_ERROR_REPORT_EMAIL',
			
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ERROR',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_WARNING',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_PARSE',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_NOTICE',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_ERROR',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_CORE_WARNING',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_ERROR',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_COMPILE_WARNING',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_ERROR',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_WARNING',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_NOTICE',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_ALL',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_STRICT',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_RECOVERABLE_ERROR',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_DEPRECATED',
			'MODULE_GAMBIO_ERROR_REPORT_HIDE_E_USER_DEPRECATED'
		);
	}
}
?>